﻿@model SearchResultViewModel


@{
    ViewData["Title"] = $"{Model.Keyword} - 搜索结果";
}

<div class="container px-4 py-3">
    <h2 class="d-flex w-100 justify-content-between pb-2 mb-3 border-bottom">
        <div>Search Results "@Model.Keyword"</div>
        <div>@Model.Posts.Count.ToString() Posts</div>
    </h2>

    <div>
        @if (Model.Posts.Count == 0) {
            <div class="d-flex justify-content-center">
                <div class="card" style="width: 18rem;">
                    <img src="~/images/codelab.jpg" class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">没有结果</h5>
                        <p class="card-text">No result.</p>
                        <a class="btn btn-primary" asp-controller="Home" asp-action="Index">返回主页</a>
                    </div>
                </div>
            </div>
        }
        @foreach (var post in Model.Posts) {
            <partial name="Widgets/PostCard" model="post"/>
        }
    </div>
</div>